(define-module (libraries mgl)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix build-system gnu)
  #:use-module (guix packages)
  #:use-module (gnu packages audio)
  #:use-module (gnu packages fontutils)
  #:use-module (gnu packages gcc)
  #:use-module (gnu packages gl)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages xiph)
  #:use-module (gnu packages xorg)
  #:use-module (guix git-download))

(define-public mgl
  (let ((commit "731bd321468745fdb5e5b925dc248ebe903662d8")
        (revision "1"))
    (package
      (name "mgl")
      (version (git-version "0.0.0" revision commit))
      (source
       (origin
	 (method git-fetch)
	 (uri
	  (git-reference
	   (url "https://github.com/Aaron-SP/mgl.git")
	   (commit commit)))
         (file-name (git-file-name name version))
	 (sha256
	  (base32
           "0zczwr77cr2hfwf1bhkc11q2jbraxwmxbmrj6ip8lcxi0vfcfdm9"))))
      (build-system gnu-build-system)
      (arguments
       `(#:test-target "tests"
         #:make-flags
         (list (string-append "MGL_DESTDIR=" (assoc-ref %outputs "out") "/include"))
         #:phases
         (modify-phases %standard-phases
           (delete 'configure))))
      (native-inputs
       `(("pkg-config" ,pkg-config)))
      (inputs
       `(("libvorbis" ,libvorbis)
         ("openal" ,openal)
         ("freetype" ,freetype)
         ("libx11" ,libx11)
         ("glew" ,glew)))
      (home-page "https://github.com/Aaron-SP/mgl")
      (synopsis "Minimal Graphics Library.")
      (description
       "This package includes the distribution of the Minimal Graphics
Library, hence abbreviated MGL.")
      (license license:asl2.0))))

(define-public bds
  (let ((commit "5ddd3f2a67884e74270b4012a78948e772299cf5")
        (revision "1"))
    (package
      (name "bds")
      (version (git-version "0.1.316" revision commit))
      (source
       (origin
	 (method git-fetch)
	 (uri
	  (git-reference
	   (url "https://github.com/Aaron-SP/bds.git")
	   (commit commit)))
         (file-name (git-file-name name version))
	 (sha256
	  (base32
           "1abq5v4jbnp8glzngwz7ksyghrvkdhkjf7wvg6f6jxv3h8y58f3v"))))
      (build-system gnu-build-system)
      (arguments
       `(#:test-target "tests"
	 #:make-flags
         (list (string-append "MGL_DESTDIR=" (assoc-ref %build-inputs "mgl") "/include")
               (string-append "DESTDIR=" (assoc-ref %outputs "out"))
               "APPLICATIONS=/share/applications"
               "PREFIX=")
	 #:phases
	 (modify-phases %standard-phases
	   (delete 'configure))))
      (native-inputs
       `(("pkg-config" ,pkg-config)))
      (inputs
       `( ("libvorbis" ,libvorbis)
	  ("openal" ,openal)
	  ("mgl" ,mgl)
          ("freetype" ,freetype)
          ("libx11" ,libx11)
	  ("glew" ,glew)))
      (home-page "https://aaron-sp.github.io/index.html")
      (synopsis "Beyond Dying Skies Official Simulation.")
      (description
       "This package includes the distribution of the Beyond Dying Skies,
, hence abbreviated BDS.")
      (license license:asl2.0))))
